1. Field of the Invention
The present invention relates to a device for converting a color image into a binary image by an error diffusion method, to a program therefore, and to a method therefore. More particularly, the present invention relates to a multi-valued image conversion device, a multi-valued image conversion program, and a multi-valued image conversion method, which are suitable for reducing the occurrence of artifacts.
2. Description of the Related Art
Hitherto, error diffusion methods have been used as methods of converting color images into binary images. The error diffusion method is one of the methods which are used when a color image composed of a group of pixels which can take N values (for instance, 256 values) is converted into binary images composed of a group of pixels which can take binary values. More specifically, a color image is divided into a plurality of lines in the horizontal direction, and a subject pixel is converted into a pixel having binary values one by one while scanning the subject pixel from left to right on the topmost line. Then, when the right end is reached on the topmost line, the scanning point moves to the left end of the second line. The same process as the above is performed for all the second and subsequent lines until the lower right pixel is reached.
The conversion of the subject pixel is performed as follows. As shown in FIG. 7, in a case where the subject pixel is denoted as x1, and adjacent pixels to the right, the lower left, below, and the lower right of the subject pixel are denoted as x2, x3, x4, and x5, respectively, when the value x1 of the subject pixel x1 exceeds a binarization threshold value Th (for example, Th=127), the pixel value v1 is converted into “1”, and when the value v1 of the subject pixel x1 is equal to or less than the binarization threshold value Th, the pixel value v1 is converted into “0”. Then, the error when the subject pixel x1 is converted into a binary value is diffused to the adjacent pixels x2 to x5 at a predetermined ratio.
An error e1 of the subject pixel x1 is computed by the following equation (1) when the pixel value v1 of the subject pixel x1 is converted into “1” and is computed by the following equation (2) when the pixel value v1 of the subject pixel x1 is converted into “0”:e1=v1−255  (1)e1=v1  (2)
Then, the values v′2 to v′5 of the adjacent pixels x2 to x5 are computed by the following equations (3) to (6) by assuming the original pixel values to be v2 to v5:v′2=v2+e1× 5/16  (3)v′3=v3+e1× 3/16  (4)v′4=v4+e1× 7/16  (5)v′5=v5+e1× 1/16  (6)
Furthermore, in addition to a case in which the error is diffused only to adjacent pixels in this manner, an error diffusion method of diffusing an error to adjacent pixels and to pixels adjacent on the opposite side of the above adjacent pixels from the subject pixel is widely known.
In this case, when neighboring pixels which are adjacent to the right and the lower right of the adjacent pixel x2 are denoted as x6 and X7, respectively, when neighboring pixels which are adjacent to the left, the lower left, below, and the lower right of the adjacent pixel x3 are denoted as x8, x9, x10, and x11, respectively, and when neighboring pixels which are adjacent below and to the lower right of the adjacent pixel x5 are denoted as x12 and X13, respectively, the error e1 of the subject pixel x1 is diffused to the adjacent pixels x2 to x5 and to the neighboring pixels x6 to x13 at a ratio of 7:5:7:5:5:3:3:1:3:5:3:1, as shown in FIG. 8. As for the ratio, in addition, a ratio of 8:4:8:4:4:2:2:1:2:4:2:1 may be adopted. However, in the conventional error diffusion method, for example, when a color image, such as an image in which the inter-pixel variance is extremely small like that used in computer graphics and a very smooth photograph, is converted into a binary image, an occurrence of the same error repeats periodically. As a result, as shown in FIG. 9, a problem arises in that unique striped patterns (artifacts) occur in the binary image. FIG. 9 shows a binary image in which a color image whose pixel values continuously change from 255 to 0 from the top to the bottom in the vertical direction is converted by a conventional error diffusion method.